/****
 * 注册
 ****/
;(function() {
	var module = {
		eventListner: function () {
			$("#register").click(function () {
				var userName = $("input[name='userName']").val().trim(),
					email = $("input[name='email']").val().trim(),
					inviteCode = $("input[name='inviteCode']").val().trim();
				if (!userName) {
					alert("请输入用户名");
					return false;
				}
				if (!email) {
					alert("请输入邮箱");
					return false;
				}
				if (!inviteCode) {
					alert("请输入邀请码");
					return false;
				}
				$.ajax({
					url: "",
					type: "post",
					data: {
						userName: userName,
						email: email,
						inviteCode: inviteCode
					},
					dataType: "json",
					success: function (data) {
						location.href = "/Views/login.html";
					},
					error: function () {
						alert("注册帐号出错");
					}
				})
			});
		},
		init: function () {
			module.eventListner();
		}
	};
	
	$(function () {
		module.init();
	});
}());